#!/bin/sh

#path to shell
export SHELL=/bin/sh

#terminal settings
export TERM=xterm
export TERMCAP=/etc/termcap
export TERMINFO=/etc/xterm
export CONSOLE=/dev/console
export HISTSIZE=1000

#export for some apps
export HOSTNAME=`/bin/hostname`

#paths settings
if [ -d /opt/etc ]; then
    export PATH=/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/etc/scripts
else
    export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/etc/scripts
fi
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
export HOME=${HOME:-/}
export TMPDIR=/tmp/
export TMP=/tmp/
export PS1='[`hostname`@`echo $PWD`]# '

#locale settings
export LANG=ru_RU.UTF-8
export LC_CTYPE=ru_RU.UTF-8
export LC_NUMERIC=ru_RU.UTF-8
export LC_TIME=ru_RU.UTF-8
export LC_COLLATE=ru_RU.UTF-8
export LC_MONETARY=ru_RU.UTF-8
export LC_MESSAGES=ru_RU.UTF-8
export LC_PAPER=ru_RU.UTF-8
export LC_NAME=ru_RU.UTF-8
export LC_ADDRESS=ru_RU.UTF-8
export LC_TELEPHONE=ru_RU.UTF-8
export LC_MEASUREMENT=ru_RU.UTF-8
export LC_IDENTIFICATION=ru_RU.UTF-8
export LC_ALL=

#memory at system
if [ -f /tmp/is_32ram_dev ]; then
    #>=32
    export MEM=32
else
    #<=16
    export MEM=16
fi

#aliases
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi

#last particion mounted to /media set as public for samba and torrent home dir
public=`df -h | grep "/dev/sd" | grep "media" | awk {' print $6 '} | tail -q -n1`

#variables for transmissions
if [ -f /bin/transmission-daemon ] && [ "$public" != "" ]; then
    export TRANSMISSION_HOME="$public"/transmission
    export TRANSMISSION_WEB_HOME=/share/transmission/web
    export XDG_DATA_HOME=/share/transmission/web
    export XDG_DATA_DIRS=/share/transmission/web
fi
